﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SCSService;

namespace SCS.Core.Models.ModelsFontend
{
    public class PostModel
    {
        #region "Category"
        public static List<Post_Category> GetListCategoryByParentId(int? parentId)
        {
            PostService postSvc = new PostService();
            return postSvc.GetListCategoryPostByParent(parentId);
        }

        public static Post_Category GetCategory(int id)
        {
            PostService postSvc = new PostService();
            return postSvc.GetCategory(id);
        }

        public static IEnumerable<Post_Category> GetListCategory()
        {
            var list = GetListCategoryByParentId(null);
            return (from p in list
                    select p);
        }
        #endregion

        #region "Post"
        public static List<Post> GetListPostByCategory(int? cateId)
        {
            PostService postSvc = new PostService();
            return postSvc.GetListPostByCategory(cateId);
        }

        public static Post GetPostByID(int id)
        {
            PostService postSvc = new PostService();
            return postSvc.GetPost(id);
        }
        #endregion
    }
}